package com.tcm.im.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {
 
    @Bean
    public RestTemplate getRestTemplate(){
        RestTemplate restTemplate = new RestTemplate();
        SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) restTemplate.getRequestFactory();
        //常用超时设置
        requestFactory.setReadTimeout(6000);
        requestFactory.setConnectTimeout(6000);
        restTemplate.setRequestFactory(requestFactory);
        return restTemplate;
    }
 
}